310a634dbb40c387db9c9174f181434a27ef4f40,xwiki-platform-tools/xwiki-platform-tool-packager-plugin/src/main/java/com/xpn/xwiki/tool/backup/AbstractPackager.java,AbstractPackager,createXWikiContext,#String#File#,59
Before Change
ExecutionContextManager ecim = Utils.getComponent(ExecutionContextManager.class);
Execution execution = Utils.getComponent(Execution.class);
try {
ExecutionContext ec = new ExecutionContext();
// Bridge with old XWiki Context, required for old code.
ec.setProperty("xwikicontext", context);
ecim.initialize(ec);
execution.setContext(ec);
} catch (ExecutionContextException e) {
throw new Exception("Failed to initialize Execution Context.", e);
}
After Change
// so that we don't get any NPE if some initializer code asks to get the Execution Context. This
// happens for example with the Velocity Execution Context initializer which in turns calls the Velocity
// Context initializers and some of them look inside the Execution Context.
execution.setContext(new ExecutionContext());
// Bridge with old XWiki Context, required for old code.
execution.getContext().setProperty("xwikicontext", context);
ecim.initialize(execution.getContext());
} catch (ExecutionContextException e) {
throw new Exception("Failed to initialize Execution Context.", e);
}